physics_particle_set_gravity_scale

Set the gravity scale factor for all particles in a physics simulation.

语法:

physics_particle_set_gravity_scale(scale)


参数 描述
scale The scaling factor to be applied to gravity for all particles.


返回: N/A(无返回值)


描述

With this function you can set the gravity scale factor for particles in the physics simulation. The function is designed to help prevent instability in the physics simulation, especially when using very small particles which may behave unpredictably (i.e. break conservation of momentum) in scenarios such as explosions. Slowing these particles down by reducing gravity scale can stabilize their behaviour. This function is global in scope, in that it will change the gravity scale not just for new particles created after the change, but also for those already present in the simulation.

NOTE: Adjusting the number of update iterations per step (using the function physics_world_update_iterations can also affect the effect of gravity on particles. Larger iteration sizes confer greater resistance to gravity.


例如:

physics_particle_set_radius(15);
physics_particle_set_density(0.5);
physics_particle_set_damping(1);
physics_particle_set_gravity_scale(1);

The above code will set the base properties for all particles in the simulation.


上一页: Soft Body Particles
下一页: physics_particle_get_max_count
© Copyright YoYo Games Ltd. 2018 All Rights Reserved